package com.ververica.cdc.guass.sink.jdbc.derby.testutil;


import com.ververica.cdc.guass.sink.jdbc.testutils.DatabaseMetadata;

/** Derby Metadata. */
public class DerbyMetadata implements DatabaseMetadata {
    private final String dbName;

    public DerbyMetadata(String schemaName) {
        dbName = "memory:" + schemaName;
    }

    public String getDbName() {
        return dbName;
    }

    @Override
    public String getJdbcUrl() {
        return String.format("jdbc:derby:%s", dbName);
    }

    @Override
    public String getJdbcUrlWithCredentials() {
        return getJdbcUrl();
    }

    @Override
    public String getUsername() {
        return "";
    }

    @Override
    public String getPassword() {
        return "";
    }

/*    @Override
    public XADataSource buildXaDataSource() {
        EmbeddedXADataSource ds = new EmbeddedXADataSource();
        ds.setDatabaseName(dbName);
        return ds;
    }*/

    @Override
    public String getDriverClass() {
        return "org.apache.derby.jdbc.EmbeddedDriver";
    }

    @Override
    public String getVersion() {
        return "derby:memory";
    }
}
